package edu.zli.redis.controller;

import edu.zli.redis.bean.Grade;
import edu.zli.redis.bean.User;
import edu.zli.redis.service.CacheService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ZerlindaLi create at 2021/12/15 14:35
 * @version 1.0.0
 * @description CacheController
 */
@RestController
@RequestMapping("api/cache")
public class CacheController {

    @Autowired
    private CacheService cacheService;

    @RequestMapping("/get")
    public User getCache(Long id) {
        return cacheService.getNavegationURLs(id);
    }

    @RequestMapping("/list")
    public List<User> listUser() {
        return cacheService.getUserList();
    }

    @RequestMapping("/getGrade")
    public Grade listUser(Long id) {
        return cacheService.getGrade(id);
    }
}
